<? if(!defined('IN_DISCUZ')) exit('Access Denied'); include template('header'); ?>
<div id="nav"><a href="<?=$indexname?>"><?=$bbname?></a> <?=$navigation?> &raquo; 创建活动</div>

<script src="include/javascript/calendar.js" type="text/javascript"></script>
<script type="text/javascript">
var postminchars = parseInt('<?=$minpostsize?>');
var postmaxchars = parseInt('<?=$maxpostsize?>');
var disablepostctrl = parseInt('<?=$disablepostctrl?>');
var typerequired = parseInt('<?=$forum['threadtypes']['required']?>');
var bbinsert = parseInt('<?=$bbinsert?>');
var seccodecheck = parseInt('<?=$seccodecheck?>');
var secqaacheck = parseInt('<?=$secqaacheck?>');
var special = 4;
var isfirstpost = 1;
var allowposttrade = parseInt('<?=$allowposttrade?>');
var allowpostreward = parseInt('<?=$allowpostreward?>');
var allowpostactivity = parseInt('<?=$allowpostactivity?>');
lang['board_allowed'] = '系统限制';
lang['lento'] = '到';
lang['bytes'] = '字节';
lang['post_curlength'] = '当前长度';
lang['post_subject_and_message_isnull'] = '请完成标题或内容栏。';
lang['post_subject_toolong'] = '您的标题超过 80 个字符的限制。';
lang['post_message_length_invalid'] = '您的帖子长度不符合要求。';
lang['post_type_isnull'] = '请选择主题对应的分类。';
lang['post_activity_sort_null'] = '对不起，请输入活动所属类别。';
lang['post_activity_fromtime_null'] = '对不起，请输入活动开始时间。';
lang['post_activity_addr_null'] = '对不起，请输入活动地点。';
</script>
<? include template('post_preview'); ?>
<form method="post" id="postform" action="post.php?action=newthread&amp;fid=<?=$fid?>&amp;extra=<?=$extra?>&amp;topicsubmit=yes" <?=$enctype?>>
<input type="hidden" name="formhash" id="formhash" value="<?=FORMHASH?>" />
<input type="hidden" name="isblog" value="<?=$isblog?>" />
<input type="hidden" name="special" value="4" />

<div class="mainbox formbox">
<span class="headactions"><a href="member.php?action=credits&amp;view=forum_post&amp;fid=<?=$fid?>" target="_blank">查看积分策略说明</a></span>
<h1>创建活动</h1>
<table summary="创建活动" cellspacing="0" cellpadding="0">

			<thead>
				<tr>
					<th>用户名</th>
					<td>
						<? if($discuz_uid) { ?>
							<?=$discuz_userss?> [<a href="<?=$link_logout?>">退出登录</a>]
						<? } else { ?>
							游客 [<a href="<?=$link_login?>">会员登录</a>]
						<? } ?>
					</td>
				</tr>
			</thead>

<? if($seccodecheck) { ?>
	<tr>
		<th><label for="seccodeverify">验证码</label></th>
		<td>
			<div id="seccodeimage"></div>
			<input type="text" onfocus="updateseccode();this.onfocus = null" id="seccodeverify" name="seccodeverify" size="8" maxlength="4" tabindex="1" />
			<em class="tips"><strong>点击输入框显示验证码</strong> <? if($seccodedata['type'] == 2) { ?>请确认您的浏览器支持 Flash 的显示，如果看不清验证码，请点<a href="###" onclick="updateseccode()">这里</a>刷新<? } elseif($seccodedata['animator'] == 1) { ?>请确认您的浏览器支持动画的显示，如果看不清验证码，请点图片刷新<? } else { ?>如果看不清验证码，请点图片刷新<? } ?></em></td>
			<script type="text/javascript">
				var seccodedata = [<?=$seccodedata['width']?>, <?=$seccodedata['height']?>, <?=$seccodedata['type']?>];
			</script>
	</tr>
<? } if($secqaacheck) { ?>
	<tr><th><span class="bold">验证问答</span></td>
	<td><div id="secquestion"></div><input type="text" name="secanswer" id="secanswer" size="25" maxlength="50" tabindex="2" />
	<script type="text/javascript">
	<? if(($attackevasive & 1) && $seccodecheck) { ?>
		setTimeout("ajaxget('ajax.php?action=updatesecqaa&inajax=1', 'secquestion')", 2001);
	<? } else { ?>
		ajaxget('ajax.php?action=updatesecqaa&inajax=1', 'secquestion');
	<? } ?>
	</script></td>
	</tr>
<? } ?>
	<thead>
		<tr>
			<th>活动信息</th>
			<td>&nbsp;</td>
		</tr>
	</thead>

	<tr>
		<th><label for="subject">活动名称</label></th>
		<td>
			<? if($iscircle && $mycircles) { ?>
				<select name='sgid'>
					<option value="0">请选择圈子</option><? if(is_array($mycircles)) { foreach($mycircles as $id => $name) { ?><option value="<?=$id?>"><?=$name?></option><? } } ?></select>
			<? } else { ?>
				<?=$typeselect?>
			<? } ?>
			<input type="text" name="subject" id="subject" size="45" value="<?=$subject?>" tabindex="3" />
		</td>
	</tr>

	<tr>
		<th><label for="activityclass">活动类别</label></th>
		<td>
			<? if($activitytypelist) { ?>
				<select onchange="this.form.activityclass.value=this.value" tabindex="4">
					<option value=""></option><? if(is_array($activitytypelist)) { foreach($activitytypelist as $type) { ?>					<option value="<?=$type?>"><?=$type?></option>
				<? } } ?></select>
			<? } ?>
			<input type="text" size="29" maxlength="45" id="activityclass" name="activityclass" tabindex="4" />
		</td>
	</tr>

	<tr>
		<th>开始时间</th>
		<td>
			<p><label><input class="radio" type="radio" value="0" name="activitytime" onclick="$('certainstarttime').style.display='';$('uncertainstarttime').style.display='none';" checked="checked" tabindex="5" />在一个确定的时间开始</label>
			<label><input class="radio" type="radio" value="1" name="activitytime" onclick="$('certainstarttime').style.display='none';$('uncertainstarttime').style.display=''"  tabindex="5" />在一个时间范围内商定</label></p>
			<span id="certainstarttime"><input onclick="showcalendar(event, this, true)" type="text" name="starttimefrom[0]" id="starttimefrom_0" size="15" value="" tabindex="5" /></span>
			<span id="uncertainstarttime" style="display: none"> <input onclick="showcalendar(event, this, true)" type="text" name="starttimefrom[1]" id="starttimefrom_1" size="20" value="" tabindex="5" /> - <input onclick="showcalendar(event, this, true)" type="text" name="starttimeto" size="20" value="" tabindex="5" /></span>
			<em class="tips">样例:<? echo date("Y-m-d H:i", $timestamp + 86400); ?></em>
		</td>
	</tr>

	<tr>
		<th><label for="activityplace">活动地点</label></th>
		<td><input type="text" size="45" name="activityplace" id="activityplace" tabindex="6" /></td>
	</tr>
	<tr>
		<th><label for="cost">每人花销</label></td>
		<td><input onkeyup="checkvalue(this.value, 'costmessage')" type="text" name="cost" id="cost" size="8" value="0" tabindex="7" /> 元 <span id="costmessage"></span></td>
	</tr>

<tr>
<? include template('post_editor'); ?>
</tr>

<? if($tagstatus) { ?>
	<tr>
		<th><label for="tags">标签(TAG)</label></th>
		<td>
			<input size="45" type="input" id="tags" name="tags" value="" tabindex="200" />&nbsp;
			<button onclick="relatekw();return false">可用标签</button><span id="tagselect"></span>
			<em class="tips">(用逗号或空格隔开多个标签，最多可填写 <strong>5</strong> 个)</em>
		</td>
	</tr>
<? } ?>
<thead>
<tr>
<td colspan="2">活动补充信息</td>
</tr>
</thead>
<tr>
<th><label for="activitycity">所在城市(扩展信息)</label></th>
<td>
<input type="text" size="45" maxlength="45" name="activitycity" id="activitycity" tabindex="201">
</td>
</tr>

<tr>
<th><label for="activitynumber">需要人数(扩展信息)</label></th>
<td><input onkeyup="checkvalue(this.value, 'activitynumbermessage')" type="text" name="activitynumber" id="activitynumber" size="45" value="" tabindex="202" /> <span id="activitynumbermessage"></span></td>
</tr>
<script type="text/javascript">
	function checkvalue(value, message){
		if(!value.search(/^\d+$/)) {
			$(message).innerHTML = '';
		} else {
			$(message).innerHTML = '<b>填写无效</b>';
		}
	}
</script>
<tr>
<th>性别</th>
<td>
<label><input type="radio" name="gender" value="0" tabindex="203" checked />不限</label>
<label><input type="radio" name="gender" value="1" tabindex="204" />男</label>
<label><input type="radio" name="gender" value="2" tabindex="205" />女</label></td>
</tr>
<tr>
<th><label for="activityexpiration">征集截止日期(扩展信息)</label></th>
<td><input onclick="showcalendar(event, this, true)" type="text" name="activityexpiration" id="activityexpiration" size="45" value="" tabindex="206" /> <em class="tips">样例:<? echo date("Y-m-d H:i", $timestamp + 86400); ?></em></td>
</tr>
<thead>
<tr>
<td colspan="2">其他信息<input id="advshow" type="checkbox" onclick="showadv()" tabindex="207" /></td>
</tr>
</thead>
<tbody id="adv" style="display: none">
<? if($allowsetreadperm) { ?>
	<tr>
	<th><label for="readperm">所需阅读权限</label></th>
	<td><input type="text" name="readperm" id="readperm" size="6" value="<?=$readperm?>" tabindex="208" /> <em class="tips">(0或空为不限制)</em></td>
	</tr>
<? } ?>

</tbody>

<tr class="btns">
	<th>&nbsp;</th>
	<td>
		<input type="hidden" name="wysiwyg" id="<?=$editorid?>_mode" value="<?=$editormode?>" />
		<button type="submit" class="submit" name="topicsubmit" id="postsubmit" value="true" tabindex="300">创建活动</button>
		<em>[完成后可按 Ctrl+Enter 发布]</em>&nbsp;&nbsp;
		&nbsp;<a href="###" id="restoredata" onclick="loadData()" title="恢复上次自动保存的数据">恢复数据</a>
	</td>
</tr>
</table></div>
</div>

</form>
<? include template('post_js'); ?>
<script type="text/javascript">
	function showadv() {
		if($("advshow").checked == true) {
			$("adv").style.display = "";
		} else {
			$("adv").style.display = "none";
		}
	}
</script>
<? include template('footer'); ?>
